From ba4485632de1d93d8aa9a2e84135a8e9373d6268 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Wed, 8 Feb 2006 15:31:38 +0000 Subject: [PATCH] x86-64 linux: call evtchn_do_upcall on irq stack and adjust irqcount Especially in the light of the recent no-idle-tick preparations in native x86-64 it is important that exit_idle() has proper state available. For this reason, the processor's irqcount must be adjusted within upcalls, and for consistency and similarity with native code this call should also execute on the processor's irq stack. At once the patch slightly simplifies the pre-existing code by copying %rdi into %rsp instead of adding 8 to %rsp, and by using %rdi instead of %rsp (avoiding a needless resource dependency) for storing the event mask. From: Jan Beulich Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S index 5c3f6e988f..438ab8f164 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S @@ -826,10 +826,16 @@ ENTRY(hypervisor_callback) ENTRY(do_hypervisor_callback) # do_hyperviosr_callback(struct *pt_regs) # Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will # see the correct pointer to the pt_regs - addq $8, %rsp # we don't return, adjust the stack frame -11: movb $0, EVENT_MASK(%rsp) + movq %rdi, %rsp # we don't return, adjust the stack frame +11: movb $0, EVENT_MASK(%rdi) + movq %gs:pda_irqstackptr,%rax + incl %gs:pda_irqcount + cmovzq %rax,%rsp + pushq %rdi call evtchn_do_upcall - jmp error_exit + popq %rsp + decl %gs:pda_irqcount + jmp error_exit #ifdef CONFIG_X86_LOCAL_APIC ENTRY(nmi) -- 2.30.2